package indi.h.mlx.util;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

public class ListUtil {
	
	public static void removeByComparable(List l, Object c) {
		for (int i = l.size() - 1; i > -1; i--) {
			Comparable<Object> object = (Comparable<Object>) l.get(i);
			if (object.compareTo(c) == 1)
				l.remove(i);
		}
	}

	public static void removeByCustom(List value, Function<Object, Boolean> f) {
		for (int i = value.size() - 1; i > -1; i--) {
			if (f.apply(value.get(i))) {
				value.remove(i);
			}
		}
	}

	public static List createListByTwo(List a, List b) {
		List l = new ArrayList(a);
		l.addAll(b);
		return l;
	}

}
